package com.southpark.demo.control.proxies.data
{
	import com.southpark.demo.control.proxies.BaseProxy;
	import com.southpark.framework.control.responders.IResponder;
	
	import lab.southpark.demo.services.fake.data.FakeGetDataService;
	
	
	
	public class GetDataProxy extends BaseProxy
	{
		
		public function GetDataProxy(responder:IResponder)
		{
			super(responder,FakeGetDataService,FakeGetDataService);
		}
		
		public function execute1(param1:String,param2:String):void
		{
			callService(new GetData1Deserializer(),"getData1",[param1,param2]);
		}
		
		public function execute2(param1:String,param2:String):void
		{
			callService(new GetData2Deserializer(),"getData2",[param1,param2]);
		}

	}
}
	
	

//internal deserializer classes
{
	import com.southpark.framework.control.proxies.IDeserializer;
	import com.southpark.demo.vo.data.DataItemVO;
	import mx.collections.ArrayCollection;
	
	
	class GetData1Deserializer implements IDeserializer
	{
		public function manageSuccess(data:Object):Object
		{
			var array:Array = new Array();
			
			for each (var item:Object in data)
			{
				array.push(new DataItemVO(item));
			};
			
			return new ArrayCollection(array);
		}
		
		public function manageFault(faultCode:String):String
		{
			 return null;
		}
	}
	
	class GetData2Deserializer implements IDeserializer
	{
		public function manageSuccess(data:Object):Object
		{
			var array:Array = new Array();
			
			for each (var item:Object in data)
			{
				array.push(new DataItemVO(item));
			};
			
			return new ArrayCollection(array);
		}
		
		public function manageFault(faultCode:String):String
		{
			 return null;
		}
	}
}